/** 该文件存放与演员相关的接口API */
import myaxios from "../MyAxios";
//引入路径前缀
import BASEURL from "../BaseUrl";
const { BaseURL } = BASEURL;

const actorApi = {
  /**
   * 新增演员
   * @param {Object} params {actorName:姓名,actorAvatat: 图片路径}
   */
  add(params) {
    let url = BaseURL + "/movie-actor/add";
    return myaxios.post(url, params);
  },

  /**
   * 通过姓名模糊查询演员列表
   * @param {Object } params {name:姓名关键字}
   */
  queryByNameLike(params) {
    let url = BaseURL + "/movie-actors/name";
    return myaxios.post(url, params);
  },

  /**
   * 删除演员
   * @param {Object} params {id:演员ID}
   */
  delete(params) {
    let url = BaseURL + "/movie-actor/del";
    return myaxios.post(url, params);
  },

  /** 查询所有演员 */
  queryAll() {
    let url = BaseURL + "/movie-actors";
    let params = { page: 1, pagesize: 50 };
    return myaxios.get(url, params);
  },
};

export default actorApi;
